<template>
	<!-- <nav-box></nav-box> -->
	<view class="main-box flex justify-content flex-col items-center" style="height: 60vh;">
		<image :src="loadingPage" style="width: 100%;" mode=""></image>
		<text>
			正在加载中，请稍后
		</text>
	</view>
</template>
<script setup name='index'>
	import {
		reactive,
		ref,
		getCurrentInstance
	} from 'vue'
	import {
		onLoad,
		onReady
	} from '@dcloudio/uni-app'
	import {
		useCommonStore
	} from '@/stores/common.js'
	const commonStore = useCommonStore()
	import {
		useUserStore
	} from '@/stores/user.js'
	import {
		parseQueryParams
	} from '@/common/common.js'

	const {
		proxy
	} = getCurrentInstance()

	const loadingPage = ref('/static/images/loading-page.svg')

	onLoad(async (options) => {
		let opt = parseQueryParams(options)
		if (opt.code) {
			proxy.$System.goTo('/pages-menus/pages/webopenid/index', {
				...opt
			}, {
				method: 'reLaunch'
			})
			return
		}

		useUserStore().getUserLoginInfo().then(res => {
			// console.log('用户信息res==>', res);
			if (res?.id && useUserStore().userType == 2) {
				console.log('111');
				proxy.$System.goTo('/pages/home/index', {}, {
					method: 'reLaunch'
				})
			} else if (res?.id && useUserStore().userType != 2) {
				console.log('222');
				proxy.$System.goTo('/pages/mch-home/index', {}, {
					method: 'reLaunch'
				})
			}
		})
		// proxy.$System.goTo('/pages/login/index')
	})
</script>
<style lang='scss' scoped>
</style>